<?php

class Application_Form_formRhPesquisa extends Zend_Form
{

    public function init()
    {
        $this->addElementPrefixPath('My_Filter', 'My/Filter', 'FILTER');
        $this->addElementPrefixPath('My_Validate', 'My/Validate', 'VALIDATE');

        $this->clearDecorators();
        $decorators = array(
            array('ViewHelper'),
            array('Errors'),
            array('Label',array(
                'class' => 'leftalign'
            )),
            array('HtmlTag',array('tag' => 'li'))
        );

        $this->setName('rh_pesquisa');

        // Campo 'CPF'
        $cpf = new Zend_Form_Element_Text('cpf');
        $cpf->setLabel('CPF')
            ->setAttrib('size', 14)
            ->addFilter('Digits')
            ->addFilter('StripTags')
            ->addFilter('StringTrim')
            ->addValidator('Cpf')
            ->setDecorators($decorators);

        // Campo 'Nome'
        $nome = new Zend_Form_Element_Text('nome');
        $nome->setLabel('Nome')
            ->setAttrib('Class', 'input-xlarge')
            ->addFilter('StripTags')
            ->addFilter('StringTrim')
            ->setDecorators($decorators);

        // Campo 'E-mail'
        $email = new Zend_Form_Element_Text('email');
        $email->setLabel('E-mail')
              ->addValidator('EmailAddress')
               ->setAttrib('size', 100)
               ->addFilter('StripTags')
               ->addFilter('StringTrim')
               ->addFilter('EmailDPF')
               ->setDecorators($decorators);

        // Botão 'Pesquisar'
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setAttrib('id', 'submitbutton');
        $submit->setDecorators(array(
            array('ViewHelper'),
            array('HtmlTag',
                array(
                'tag' => 'li',
                'class' => 'submit'))
        ));

        $this->setDecorators(array(
           'FormElements',
            array('HtmlTag',array('tag'=>'ul')),
            array(
                array(
                    'DivTag'=>'HtmlTag'
                ),
                array(
                    'tag'=>'div',
                    'class'=>'FormDiv'
                )
            ),
            'Form'
        ));

        $this->addElements(array($cpf, $nome, $email, $submit));
    }
}